close; clear; clc;
Nt = 50; Nl = 500; 
nl = 100;
Fai = pi / 2;
u = 4*pi*10^(-7); p1 = 100;
i = sqrt(-1);
for it = 1:Nt
    w(it) = 10 ^ (it/10);
    k1(it) = sqrt(-i*w(it)*u/p1);
    for il = 1:Nl
        r(il) = il * nl;
        PE(il) = 1.0 * r(il);
        Ex(it,il) = PE(il) * p1 / (pi*r(il)^3);
        ExA(it,il) = abs(Ex(it,il));
        ExB(it,il) = angle(Ex(it,il));
        Hy(it,il) = -PE(il) / (pi*r(il)^3 * k1(it));
        HyA(it,il) = abs(Hy(it,il));
        HyB(it,il) = angle(Hy(it,il));
        Hz(it,il) = 3 * PE(il) * p1 / (2*pi*r(il)^4 * i*w(it)*u);
        HzA(it,il) = abs(Hz(it,il));
        HzB(it,il) = angle(Hz(it,il));
    end
    
    pEx(it) = pi*r
    
end


figure(1)
loglog(w(:),ExA(:,20))

figure(2)
loglog(w(:),HyA(:,20))